Skip to content

tui: v views the file under the cursor, under the panes - #41

Merged
ralyodio merged 1 commit into
mainfrom
worktree-tui-view-document
Sep 13, 2026
Merged

ralyodio merged 1 commit into
mainfrom
worktree-tui-view-document

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

What

diskpush tui can now open the file under the cursor under the panes. Press v (or ⏎ on a file, or click a file while the viewer is open). The panes shrink to a fixed share of the screen and the document takes the rest. esc or v closes it.

╭─  ▪ Local  ──────────── /home/me/project ─┬─  ▪ prod  ──────────── /srv/app ─╮
│ ↑ ..                                      │ ↑ ..                             │
│ ▸ src                                     │   bundle.js              1.5M    │
│   README.md                        4.1K   │                                  │
╰─  2 items  ·  4.1K  ·  name▲  ────────────┴─  1 item  ·  1.5M  ·  name▲  ───╯
╭─  README.md  ───────────────────────────────────── /home/me/project/README.md ─╮
│ DiskPush                                                                   █ │
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │ │
│ Push files fast. Sync only what changed.                                   │ │
╰─  lines 1–16 of 180  ·  markdown  ·  6.6K  ──────────────────────────────────╯
 tab pane  ↑↓ file  pgdn pgup page  g G top end  esc close  q quit

It is a preview, not a detour: the arrows stay with the panes, so with a file open, ↑ ↓ walk from file to file and the viewer follows. pgdn pgup (also space / b) page the document, g G jump to its ends, and the wheel scrolls it. Works on local and remote panes alike; a remote file is read over the same SFTP session the listing came from.

How it reads files

  • Markdown is rendered by our own @profullstack/readm3 — the renderer behind readm3.com and the readm3 reader — which returns role-tagged spans; readm3's colorOf maps them onto the TUI theme. Headings, lists, fences, quotes, links, GitHub alerts, all of it.
  • An extensionless file (README, NOTES) is routed by @profullstack/text-type-detection: if the house detector says markdown, it is rendered as markdown.
  • Text shows as numbered lines with tabs widened.
  • Binary shows as a hex dump of its head. Binary is a NUL in the first 8 KB, or a tenth of the head being control bytes or invalid UTF-8 — the second rule was added after a 300-byte random file with no NUL rendered as a screen of garbage in the pty run.
  • Only the first 1 MB is ever read (SftpBrowser.readHead, new, and a local equivalent), so pointing the viewer at a 40 GB backup costs one megabyte. The footer says first 1.0M of 40G when that happens.

Tests

  • 48 new tests across model, document, view and interaction: kind detection, hex rows, head reads, the pane/document row split at 30, 18 and 12 rows, the footer position and truncation note, the layout report, wheel scrolling over the text and the scrollbar, the footer caps, and the whole flow driven through Tui — v, ⏎, esc, following the cursor across a directory, paging and clamping, the remote read and its error, and a preview taking the rows back.
  • 671 tests pass across the repo; pnpm typecheck is clean.
  • The built binary was driven in a pty (python pty.fork + pyte) through every kind of file, paging, help, and close. That run is where the binary-detection gap was found.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AhtFxxWvkm4izFq8Y1RQBo

`v`, or ⏎ on a file, opens it beneath the two panes: the panes keep a
fixed share of the screen and the document takes the rest. The arrows
stay with the panes so the viewer follows the cursor from file to file;
pgdn/pgup/space/b page the document, g/G jump, the wheel scrolls, and
esc or v closes it. Remote files are read over the same SFTP session
the listing came from.

Markdown is rendered by @profullstack/readm3 (the readm3.com renderer)
with its roles mapped onto the theme; an extensionless file that
@profullstack/text-type-detection calls markdown is rendered too; other
text shows as numbered lines; a binary as a hex dump of its head. Only
the first megabyte is read, via a new SftpBrowser.readHead and a local
equivalent, and the footer says so when that is not the whole file.

Binary is a NUL in the head, or a tenth of it control bytes or invalid
UTF-8: the second rule came from driving the built binary in a pty,
where a 300-byte random file with no NUL rendered as garbage text.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AhtFxxWvkm4izFq8Y1RQBo
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​profullstack/​readm3@​0.3.07710010092100
Added@​profullstack/​text-type-detection@​1.0.0100100100100100

View full report

@socket-security

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn Medium
Low adoption: npm @profullstack/hqtui

Location: Package overview

From: pnpm-lock.yaml → npm/@profullstack/readm3@0.3.0 → npm/@profullstack/hqtui@0.1.12

ℹ Read more on: This package | This alert | What are unpopular packages?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Unpopular packages may have less maintenance and contain other problems.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@profullstack/hqtui@0.1.12. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Low adoption: npm @profullstack/readm3

Location: Package overview

From: apps/cli/package.json → npm/@profullstack/readm3@0.3.0

ℹ Read more on: This package | This alert | What are unpopular packages?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Unpopular packages may have less maintenance and contain other problems.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@profullstack/readm3@0.3.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@ralyodio
ralyodio merged commit 6478781 into main Sep 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant